package blackhouse_servlet;

import blackhouse_server.addresult_server;

import com.alibaba.fastjson.JSON;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.io.PrintWriter;

/*

 * 添加信息Servlet类

 */

@WebServlet("/addresult")
public class addresult_servlet extends HttpServlet {
	addresult_server addresult=new addresult_server();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		int a=-1;
		try {
			req.setCharacterEncoding("utf-8");
			resp.setCharacterEncoding("utf-8");
			String info = req.getParameter("info");
			a=addresult.addresult_server(info);
			PrintWriter writer = resp.getWriter();
			writer.print(a);
		} catch (Exception e) {
			PrintWriter writer = resp.getWriter();
			writer.print(a);
		}
			
			
		

	}

}
